﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using System.Windows.Controls.Primitives;

namespace BaiduIntern
{
    public partial class MainPage : PhoneApplicationPage
    {
        // 构造函数
        public MainPage()
        {
            InitializeComponent();
        }

        private void ApplicationBar_StateChanged(object sender, Microsoft.Phone.Shell.ApplicationBarStateChangedEventArgs e)
        {
            ApplicationBar.Opacity = e.IsMenuVisible ? 1 : 0;
        }



        private void ApplicationBarMenuItem_Click(object sender, EventArgs e)
        {
            string location = (sender as ApplicationBarMenuItem).Text;
            if (location == "全部")
                mainView.List.ItemsSource = (Application.Current as App).Jobs;
            else
                mainView.List.ItemsSource = (Application.Current as App).Jobs.Select<Model.InternJob, Model.InternJob>(i => i.Location == location ? i : null);
            
            
        }

        private void ApplicationBarMenuItem_Click_1(object sender, EventArgs e)
        {
            NavigationService.Navigate(new Uri("/View/AboutView.xaml", UriKind.Relative));
        }
    }
}